<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>集合</title>
</head>
<body>
  <script>
    //声明一个 set
    let s = new Set();
    let s2 = new Set(['大事儿','小事儿','好事儿','坏事儿','小事儿']);

    //元素个数
    // console.log(s2.size);
    //增加新的元素
    s2.add('喜事儿');
    // //删除元素
    s2.delete('坏事儿')
    //检测
    console.log(s2.has('好事儿'));
    //清空
    // s2.clear()

    for(let v of s2){
      console.log(v);
    }
    console.log(s2)
  </script>
</body>
</html>